<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        section {
            display: flex;
        }

        p:nth-child(1),
        p:nth-child(3) {
            width: 100px;
            height: 300px;
        }

        p:nth-child(2) {
            /* flex-grow: 1; */
            /* 根据空间可以进行扩大也可以进行缩小 */
            /* flex-grow: 1; flex-shrink: 1; flex-basis: 0%; */
            /* flex:1 1 0% */
            flex: 1;
        }

        p:nth-child(1) {
            background-color: red;
        }

        p:nth-child(2) {
            background-color: blue;
        }

        p:nth-child(3) {
            background-color: yellow;
        }
    </style>
</head>

<body>
    <section>
        <p>p元素1</p>
        <p>p元素2</p>
        <!-- <p>p元素3</p> -->
    </section>
</body>

</html>